package com.gxc.feign;

import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author GongXincheng
 * @since 2019-08-25 02:21
 */
@Component
public class OrderFeignFallbackFactory implements FallbackFactory<OrderFeign> {

    private final Logger log = LoggerFactory.getLogger(this.getClass());

    @Override
    public OrderFeign create(Throwable throwable) {
        return new OrderFeign() {
            @Override
            public Object getOrder() {
                log.error("Order服务被降级...");
                return null;
            }
        };
    }
}
